from django.conf.urls import url
from .  import views
from rest_framework_jwt.views import obtain_jwt_token
from .views import AddressViewSet
from rest_framework.routers import DefaultRouter

router = DefaultRouter()

router.register(r'addresses',AddressViewSet,base_name='address')


urlpatterns = [
    url(r'^usernames/(?P<username>\w{5,20})/count/$',views.RegisterUsernameCountAPIView.as_view(),name='usernamecount'),
# 请求方式： GET / users / phones / (?P < mobile > 1[345789]\d{9}) / count /
    url(r'^phones/(?P<mobile>1[3456789]\d{9})/count/$',views.RegisterMobileView.as_view()),

    url(r'^$',views.CreateUserView.as_view()),

    url(r'^auths/$',obtain_jwt_token),

    # GET /users/infos/
    url(r'^infos/$',views.UserDetailView.as_view()),

    #PUT /users/emails/
    url(r'^emails/$',views.EmailView.as_view(),name='send_mail'),

# GET /users/emails/verification/?token=xxxx
    url(r'^emails/verification/$',views.VerificationEmailView.as_view()),

    # /users/browerhistories/
    url(r'^browerhistories/$',views.UserBrowsingHistoryView.as_view()),




]
urlpatterns += router.urls


